package com.yww.mapper;

import com.yww.entity.RoleModules;
import com.yww.entity.Roles;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob杨雯雯
 * @since 2020-05-19
 */

public interface RolesMapper extends BaseMapper<Roles> {
    /**
     * 根据用户id查询穿梭框该用户的当前角色
     * @param userId
     * @return
     */
    List<Roles> getRightRole(Integer userId);

    //查询角色名是否重复
    @Select("select role_name from roles where role_name=#{roleName}")
    List<Roles> getRoleName(Roles roles);

    //判断角色是否拥有模块
    @Select("select * from role_modules where roles_id=#{roleId}")
    List<RoleModules> getRolesContainsMod(Integer roleId);
}
